<?php
	/**
	 * The abstract AssetsauditlogGen class defined here is
	 * code-generated and contains all the basic CRUD-type functionality as well as
	 * basic methods to handle relationships and index-based loading.
	 *
	 * To use, you should use the Assetsauditlog subclass which
	 * extends this AssetsauditlogGen class.
	 *
	 * Because subsequent re-code generations will overwrite any changes to this
	 * file, you should leave this file unaltered to prevent yourself from losing
	 * any information or code changes.  All customizations should be done by
	 * overriding existing or implementing new methods, properties and variables
	 * in the Assetsauditlog class.
	 * 
	 * @package My Application
	 * @subpackage GeneratedDataObjects
	 * @property-read integer $Id the value for intId (Read-Only PK)
	 * @property string $Asin the value for strAsin (Not Null)
	 * @property string $Email the value for strEmail 
	 * @property QDateTime $TakenDate the value for dttTakenDate 
	 * @property QDateTime $ActualReturnDate the value for dttActualReturnDate 
	 * @property QDateTime $RealReturnDate the value for dttRealReturnDate (Not Null)
	 * @property string $FullName the value for strFullName (Not Null)
	 * @property string $Title the value for strTitle (Not Null)
	 * @property string $Owner the value for strOwner (Not Null)
	 * @property-read boolean $__Restored whether or not this object was restored from the database (as opposed to created new)
	 */
	class AssetsauditlogGen extends QBaseClass {

		///////////////////////////////////////////////////////////////////////
		// PROTECTED MEMBER VARIABLES and TEXT FIELD MAXLENGTHS (if applicable)
		///////////////////////////////////////////////////////////////////////
		
		/**
		 * Protected member variable that maps to the database PK Identity column assetsauditlog.id
		 * @var integer intId
		 */
		protected $intId;
		const IdDefault = null;


		/**
		 * Protected member variable that maps to the database column assetsauditlog.Asin
		 * @var string strAsin
		 */
		protected $strAsin;
		const AsinMaxLength = 20;
		const AsinDefault = null;


		/**
		 * Protected member variable that maps to the database column assetsauditlog.Email
		 * @var string strEmail
		 */
		protected $strEmail;
		const EmailDefault = null;


		/**
		 * Protected member variable that maps to the database column assetsauditlog.TakenDate
		 * @var QDateTime dttTakenDate
		 */
		protected $dttTakenDate;
		const TakenDateDefault = null;


		/**
		 * Protected member variable that maps to the database column assetsauditlog.ActualReturnDate
		 * @var QDateTime dttActualReturnDate
		 */
		protected $dttActualReturnDate;
		const ActualReturnDateDefault = null;


		/**
		 * Protected member variable that maps to the database column assetsauditlog.RealReturnDate
		 * @var QDateTime dttRealReturnDate
		 */
		protected $dttRealReturnDate;
		const RealReturnDateDefault = null;


		/**
		 * Protected member variable that maps to the database column assetsauditlog.FullName
		 * @var string strFullName
		 */
		protected $strFullName;
		const FullNameMaxLength = 100;
		const FullNameDefault = null;


		/**
		 * Protected member variable that maps to the database column assetsauditlog.title
		 * @var string strTitle
		 */
		protected $strTitle;
		const TitleDefault = null;


		/**
		 * Protected member variable that maps to the database column assetsauditlog.Owner
		 * @var string strOwner
		 */
		protected $strOwner;
		const OwnerMaxLength = 10;
		const OwnerDefault = null;


		/**
		 * Protected array of virtual attributes for this object (e.g. extra/other calculated and/or non-object bound
		 * columns from the run-time database query result for this object).  Used by InstantiateDbRow and
		 * GetVirtualAttribute.
		 * @var string[] $__strVirtualAttributeArray
		 */
		protected $__strVirtualAttributeArray = array();

		/**
		 * Protected internal member variable that specifies whether or not this object is Restored from the database.
		 * Used by Save() to determine if Save() should perform a db UPDATE or INSERT.
		 * @var bool __blnRestored;
		 */
		protected $__blnRestored;




		///////////////////////////////
		// PROTECTED MEMBER OBJECTS
		///////////////////////////////





		///////////////////////////////
		// CLASS-WIDE LOAD AND COUNT METHODS
		///////////////////////////////

		/**
		 * Static method to retrieve the Database object that owns this class.
		 * @return QDatabaseBase reference to the Database object that can query this class
		 */
		public static function GetDatabase() {
			return QApplication::$Database[1];
		}

		/**
		 * Load a Assetsauditlog from PK Info
		 * @param integer $intId
		 * @return Assetsauditlog
		 */
		public static function Load($intId) {
			// Use QuerySingle to Perform the Query
			return Assetsauditlog::QuerySingle(
				QQ::Equal(QQN::Assetsauditlog()->Id, $intId)
			);
		}

		/**
		 * Load all Assetsauditlogs
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return Assetsauditlog[]
		 */
		public static function LoadAll($objOptionalClauses = null) {
			if (func_num_args() > 1) {
				throw new QCallerException("LoadAll must be called with an array of optional clauses as a single argument");
			}
			// Call Assetsauditlog::QueryArray to perform the LoadAll query
			try {
				return Assetsauditlog::QueryArray(QQ::All(), $objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count all Assetsauditlogs
		 * @return int
		 */
		public static function CountAll() {
			// Call Assetsauditlog::QueryCount to perform the CountAll query
			return Assetsauditlog::QueryCount(QQ::All());
		}




		///////////////////////////////
		// QCUBED QUERY-RELATED METHODS
		///////////////////////////////

		/**
		 * Internally called method to assist with calling Qcubed Query for this class
		 * on load methods.
		 * @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause object or array of QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
		 * @param boolean $blnCountOnly only select a rowcount
		 * @return string the query statement
		 */
		protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly) {
			// Get the Database Object for this Class
			$objDatabase = Assetsauditlog::GetDatabase();

			// Create/Build out the QueryBuilder object with Assetsauditlog-specific SELET and FROM fields
			$objQueryBuilder = new QQueryBuilder($objDatabase, 'assetsauditlog');
			Assetsauditlog::GetSelectFields($objQueryBuilder);
			$objQueryBuilder->AddFromItem('assetsauditlog');

			// Set "CountOnly" option (if applicable)
			if ($blnCountOnly)
				$objQueryBuilder->SetCountOnlyFlag();

			// Apply Any Conditions
			if ($objConditions)
				try {
					$objConditions->UpdateQueryBuilder($objQueryBuilder);
				} catch (QCallerException $objExc) {
					$objExc->IncrementOffset();
					throw $objExc;
				}

			// Iterate through all the Optional Clauses (if any) and perform accordingly
			if ($objOptionalClauses) {
				if ($objOptionalClauses instanceof QQClause)
					$objOptionalClauses->UpdateQueryBuilder($objQueryBuilder);
				else if (is_array($objOptionalClauses))
					foreach ($objOptionalClauses as $objClause)
						$objClause->UpdateQueryBuilder($objQueryBuilder);
				else
					throw new QCallerException('Optional Clauses must be a QQClause object or an array of QQClause objects');
			}

			// Get the SQL Statement
			$strQuery = $objQueryBuilder->GetStatement();

			// Prepare the Statement with the Query Parameters (if applicable)
			if ($mixParameterArray) {
				if (is_array($mixParameterArray)) {
					if (count($mixParameterArray))
						$strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);

					// Ensure that there are no other Unresolved Named Parameters
					if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false)
						throw new QCallerException('Unresolved named parameters in the query');
				} else
					throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
			}

			// Return the Objects
			return $strQuery;
		}

		/**
		 * Static Qcubed Query method to query for a single Assetsauditlog object.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return Assetsauditlog the queried object
		 */
		public static function QuerySingle(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = Assetsauditlog::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
			
			// Perform the Query, Get the First Row, and Instantiate a new Assetsauditlog object
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			
			// Do we have to expand anything?
			if ($objQueryBuilder->ExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = Assetsauditlog::InstantiateDbRow($objDbRow, null, $objQueryBuilder->ExpandAsArrayNodes, $objToReturn, $objQueryBuilder->ColumnAliasArray);
					if ($objItem)
						$objToReturn[] = $objItem;					
				}			
				// Since we only want the object to return, lets return the object and not the array.
				return $objToReturn[0];
			} else {
				// No expands just return the first row
				$objToReturn = null;
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn = Assetsauditlog::InstantiateDbRow($objDbRow, null, null, null, $objQueryBuilder->ColumnAliasArray);
			}
			
			return $objToReturn;
		}

		/**
		 * Static Qcubed Query method to query for an array of Assetsauditlog objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return Assetsauditlog[] the queried objects as an array
		 */
		public static function QueryArray(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = Assetsauditlog::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and Instantiate the Array Result
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			return Assetsauditlog::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
		}

		/**
		 * Static Qcubed Query method to query for a count of Assetsauditlog objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return integer the count of queried objects as an integer
		 */
		public static function QueryCount(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = Assetsauditlog::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, true);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and return the row_count
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);

			// Figure out if the query is using GroupBy
			$blnGrouped = false;

			if ($objOptionalClauses) foreach ($objOptionalClauses as $objClause) {
				if ($objClause instanceof QQGroupBy) {
					$blnGrouped = true;
					break;
				}
			}

			if ($blnGrouped)
				// Groups in this query - return the count of Groups (which is the count of all rows)
				return $objDbResult->CountRows();
			else {
				// No Groups - return the sql-calculated count(*) value
				$strDbRow = $objDbResult->FetchRow();
				return QType::Cast($strDbRow[0], QType::Integer);
			}
		}

/*		public static function QueryArrayCached($strConditions, $mixParameterArray = null) {
			// Get the Database Object for this Class
			$objDatabase = Assetsauditlog::GetDatabase();

			// Lookup the QCache for This Query Statement
			$objCache = new QCache('query', 'assetsauditlog_' . serialize($strConditions));
			if (!($strQuery = $objCache->GetData())) {
				// Not Found -- Go ahead and Create/Build out a new QueryBuilder object with Assetsauditlog-specific fields
				$objQueryBuilder = new QQueryBuilder($objDatabase);
				Assetsauditlog::GetSelectFields($objQueryBuilder);
				Assetsauditlog::GetFromFields($objQueryBuilder);

				// Ensure the Passed-in Conditions is a string
				try {
					$strConditions = QType::Cast($strConditions, QType::String);
				} catch (QCallerException $objExc) {
					$objExc->IncrementOffset();
					throw $objExc;
				}

				// Create the Conditions object, and apply it
				$objConditions = eval('return ' . $strConditions . ';');

				// Apply Any Conditions
				if ($objConditions)
					$objConditions->UpdateQueryBuilder($objQueryBuilder);

				// Get the SQL Statement
				$strQuery = $objQueryBuilder->GetStatement();

				// Save the SQL Statement in the Cache
				$objCache->SaveData($strQuery);
			}

			// Prepare the Statement with the Parameters
			if ($mixParameterArray)
				$strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);

			// Perform the Query and Instantiate the Array Result
			$objDbResult = $objDatabase->Query($strQuery);
			return Assetsauditlog::InstantiateDbResult($objDbResult);
		}*/

		/**
		 * Updates a QQueryBuilder with the SELECT fields for this Assetsauditlog
		 * @param QQueryBuilder $objBuilder the Query Builder object to update
		 * @param string $strPrefix optional prefix to add to the SELECT fields
		 */
		public static function GetSelectFields(QQueryBuilder $objBuilder, $strPrefix = null) {
			if ($strPrefix) {
				$strTableName = $strPrefix;
				$strAliasPrefix = $strPrefix . '__';
			} else {
				$strTableName = 'assetsauditlog';
				$strAliasPrefix = '';
			}

			$objBuilder->AddSelectItem($strTableName, 'id', $strAliasPrefix . 'id');
			$objBuilder->AddSelectItem($strTableName, 'Asin', $strAliasPrefix . 'Asin');
			$objBuilder->AddSelectItem($strTableName, 'Email', $strAliasPrefix . 'Email');
			$objBuilder->AddSelectItem($strTableName, 'TakenDate', $strAliasPrefix . 'TakenDate');
			$objBuilder->AddSelectItem($strTableName, 'ActualReturnDate', $strAliasPrefix . 'ActualReturnDate');
			$objBuilder->AddSelectItem($strTableName, 'RealReturnDate', $strAliasPrefix . 'RealReturnDate');
			$objBuilder->AddSelectItem($strTableName, 'FullName', $strAliasPrefix . 'FullName');
<<<<<<< .mine
			$objBuilder->AddSelectItem($strTableName, 'title', $strAliasPrefix . 'title');
=======
			$objBuilder->AddSelectItem($strTableName, 'title', $strAliasPrefix . 'title');
			$objBuilder->AddSelectItem($strTableName, 'Owner', $strAliasPrefix . 'Owner');
>>>>>>> .r75
		}



		///////////////////////////////
		// INSTANTIATION-RELATED METHODS
		///////////////////////////////

		/**
		 * Instantiate a Assetsauditlog from a Database Row.
		 * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
		 * is calling this Assetsauditlog::InstantiateDbRow in order to perform
		 * early binding on referenced objects.
		 * @param DatabaseRowBase $objDbRow
		 * @param string $strAliasPrefix
		 * @param string $strExpandAsArrayNodes
		 * @param QBaseClass $arrPreviousItem
		 * @param string[] $strColumnAliasArray
		 * @return Assetsauditlog
		*/
		public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $arrPreviousItems = null, $strColumnAliasArray = array()) {
			// If blank row, return null
			if (!$objDbRow) {
				return null;
			}

			// Create a new instance of the Assetsauditlog object
			$objToReturn = new Assetsauditlog();
			$objToReturn->__blnRestored = true;

			$strAliasName = array_key_exists($strAliasPrefix . 'id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'id'] : $strAliasPrefix . 'id';
			$objToReturn->intId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'Asin', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'Asin'] : $strAliasPrefix . 'Asin';
			$objToReturn->strAsin = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'Email', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'Email'] : $strAliasPrefix . 'Email';
			$objToReturn->strEmail = $objDbRow->GetColumn($strAliasName, 'Blob');
			$strAliasName = array_key_exists($strAliasPrefix . 'TakenDate', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'TakenDate'] : $strAliasPrefix . 'TakenDate';
			$objToReturn->dttTakenDate = $objDbRow->GetColumn($strAliasName, 'Date');
			$strAliasName = array_key_exists($strAliasPrefix . 'ActualReturnDate', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'ActualReturnDate'] : $strAliasPrefix . 'ActualReturnDate';
			$objToReturn->dttActualReturnDate = $objDbRow->GetColumn($strAliasName, 'Date');
			$strAliasName = array_key_exists($strAliasPrefix . 'RealReturnDate', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'RealReturnDate'] : $strAliasPrefix . 'RealReturnDate';
			$objToReturn->dttRealReturnDate = $objDbRow->GetColumn($strAliasName, 'Date');
			$strAliasName = array_key_exists($strAliasPrefix . 'FullName', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'FullName'] : $strAliasPrefix . 'FullName';
			$objToReturn->strFullName = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'title', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'title'] : $strAliasPrefix . 'title';
			$objToReturn->strTitle = $objDbRow->GetColumn($strAliasName, 'Blob');
			$strAliasName = array_key_exists($strAliasPrefix . 'Owner', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'Owner'] : $strAliasPrefix . 'Owner';
			$objToReturn->strOwner = $objDbRow->GetColumn($strAliasName, 'VarChar');

			if (isset($arrPreviousItems) && is_array($arrPreviousItems)) {
				foreach ($arrPreviousItems as $objPreviousItem) {
					if ($objToReturn->Id != $objPreviousItem->Id) {
						continue;
					}

					// complete match - all primary key columns are the same
					return null;
				}
			}

			// Instantiate Virtual Attributes
			foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
				$strVirtualPrefix = $strAliasPrefix . '__';
				$strVirtualPrefixLength = strlen($strVirtualPrefix);
				if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix)
					$objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
			}

			// Prepare to Check for Early/Virtual Binding
			if (!$strAliasPrefix)
				$strAliasPrefix = 'assetsauditlog__';




			return $objToReturn;
		}

		/**
		 * Instantiate an array of Assetsauditlogs from a Database Result
		 * @param DatabaseResultBase $objDbResult
		 * @param string $strExpandAsArrayNodes
		 * @param string[] $strColumnAliasArray
		 * @return Assetsauditlog[]
		 */
		public static function InstantiateDbResult(QDatabaseResultBase $objDbResult, $strExpandAsArrayNodes = null, $strColumnAliasArray = null) {
			$objToReturn = array();
			
			if (!$strColumnAliasArray)
				$strColumnAliasArray = array();

			// If blank resultset, then return empty array
			if (!$objDbResult)
				return $objToReturn;

			// Load up the return array with each row
			if ($strExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = Assetsauditlog::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objToReturn, $strColumnAliasArray);
					if ($objItem) {
						$objToReturn[] = $objItem;
					}
				}
			} else {
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn[] = Assetsauditlog::InstantiateDbRow($objDbRow, null, null, null, $strColumnAliasArray);
			}

			return $objToReturn;
		}



		///////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Single Load and Array)
		///////////////////////////////////////////////////
			
		/**
		 * Load a single Assetsauditlog object,
		 * by Id Index(es)
		 * @param integer $intId
		 * @return Assetsauditlog
		*/
		public static function LoadById($intId) {
			return Assetsauditlog::QuerySingle(
				QQ::Equal(QQN::Assetsauditlog()->Id, $intId)
			);
		}



		////////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Array via Many to Many)
		////////////////////////////////////////////////////




		//////////////////////////
		// SAVE, DELETE AND RELOAD
		//////////////////////////

		/**
		 * Save this Assetsauditlog
		 * @param bool $blnForceInsert
		 * @param bool $blnForceUpdate
		 * @return int
		 */
		public function Save($blnForceInsert = false, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = Assetsauditlog::GetDatabase();

			$mixToReturn = null;

			try {
				if ((!$this->__blnRestored) || ($blnForceInsert)) {
					// Perform an INSERT query
					$objDatabase->NonQuery('
						INSERT INTO `assetsauditlog` (
							`Asin`,
							`Email`,
							`TakenDate`,
							`ActualReturnDate`,
							`RealReturnDate`,
							`FullName`,
<<<<<<< .mine
							`title`
=======
							`title`,
							`Owner`
>>>>>>> .r75
						) VALUES (
							' . $objDatabase->SqlVariable($this->strAsin) . ',
							' . $objDatabase->SqlVariable($this->strEmail) . ',
							' . $objDatabase->SqlVariable($this->dttTakenDate) . ',
							' . $objDatabase->SqlVariable($this->dttActualReturnDate) . ',
							' . $objDatabase->SqlVariable($this->dttRealReturnDate) . ',
							' . $objDatabase->SqlVariable($this->strFullName) . ',
							' . $objDatabase->SqlVariable($this->strTitle) . ',
							' . $objDatabase->SqlVariable($this->strOwner) . '
						)
					');

					// Update Identity column and return its value
					$mixToReturn = $this->intId = $objDatabase->InsertId('assetsauditlog', 'id');
				} else {
					// Perform an UPDATE query

					// First checking for Optimistic Locking constraints (if applicable)

					// Perform the UPDATE query
					$objDatabase->NonQuery('
						UPDATE
							`assetsauditlog`
						SET
							`Asin` = ' . $objDatabase->SqlVariable($this->strAsin) . ',
							`Email` = ' . $objDatabase->SqlVariable($this->strEmail) . ',
							`TakenDate` = ' . $objDatabase->SqlVariable($this->dttTakenDate) . ',
							`ActualReturnDate` = ' . $objDatabase->SqlVariable($this->dttActualReturnDate) . ',
							`RealReturnDate` = ' . $objDatabase->SqlVariable($this->dttRealReturnDate) . ',
							`FullName` = ' . $objDatabase->SqlVariable($this->strFullName) . ',
<<<<<<< .mine
							`title` = ' . $objDatabase->SqlVariable($this->strTitle) . '
=======
							`title` = ' . $objDatabase->SqlVariable($this->strTitle) . ',
							`Owner` = ' . $objDatabase->SqlVariable($this->strOwner) . '
>>>>>>> .r75
						WHERE
							`id` = ' . $objDatabase->SqlVariable($this->intId) . '
					');
				}

			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Update __blnRestored and any Non-Identity PK Columns (if applicable)
			$this->__blnRestored = true;


			// Return 
			return $mixToReturn;
		}

		/**
		 * Delete this Assetsauditlog
		 * @return void
		 */
		public function Delete() {
			if ((is_null($this->intId)))
				throw new QUndefinedPrimaryKeyException('Cannot delete this Assetsauditlog with an unset primary key.');

			// Get the Database Object for this Class
			$objDatabase = Assetsauditlog::GetDatabase();


			// Perform the SQL Query
			$objDatabase->NonQuery('
				DELETE FROM
					`assetsauditlog`
				WHERE
					`id` = ' . $objDatabase->SqlVariable($this->intId) . '');
		}

		/**
		 * Delete all Assetsauditlogs
		 * @return void
		 */
		public static function DeleteAll() {
			// Get the Database Object for this Class
			$objDatabase = Assetsauditlog::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				DELETE FROM
					`assetsauditlog`');
		}

		/**
		 * Truncate assetsauditlog table
		 * @return void
		 */
		public static function Truncate() {
			// Get the Database Object for this Class
			$objDatabase = Assetsauditlog::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				TRUNCATE `assetsauditlog`');
		}

		/**
		 * Reload this Assetsauditlog from the database.
		 * @return void
		 */
		public function Reload() {
			// Make sure we are actually Restored from the database
			if (!$this->__blnRestored)
				throw new QCallerException('Cannot call Reload() on a new, unsaved Assetsauditlog object.');

			// Reload the Object
			$objReloaded = Assetsauditlog::Load($this->intId);

			// Update $this's local variables to match
			$this->strAsin = $objReloaded->strAsin;
			$this->strEmail = $objReloaded->strEmail;
			$this->dttTakenDate = $objReloaded->dttTakenDate;
			$this->dttActualReturnDate = $objReloaded->dttActualReturnDate;
			$this->dttRealReturnDate = $objReloaded->dttRealReturnDate;
			$this->strFullName = $objReloaded->strFullName;
			$this->strTitle = $objReloaded->strTitle;
			$this->strOwner = $objReloaded->strOwner;
		}



		////////////////////
		// PUBLIC OVERRIDERS
		////////////////////

				/**
		 * Override method to perform a property "Get"
		 * This will get the value of $strName
		 *
		 * @param string $strName Name of the property to get
		 * @return mixed
		 */
		public function __get($strName) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'Id':
					/**
					 * Gets the value for intId (Read-Only PK)
					 * @return integer
					 */
					return $this->intId;

				case 'Asin':
					/**
					 * Gets the value for strAsin (Not Null)
					 * @return string
					 */
					return $this->strAsin;

				case 'Email':
					/**
					 * Gets the value for strEmail 
					 * @return string
					 */
					return $this->strEmail;

				case 'TakenDate':
					/**
					 * Gets the value for dttTakenDate 
					 * @return QDateTime
					 */
					return $this->dttTakenDate;

				case 'ActualReturnDate':
					/**
					 * Gets the value for dttActualReturnDate 
					 * @return QDateTime
					 */
					return $this->dttActualReturnDate;

				case 'RealReturnDate':
					/**
					 * Gets the value for dttRealReturnDate (Not Null)
					 * @return QDateTime
					 */
					return $this->dttRealReturnDate;

				case 'FullName':
					/**
					 * Gets the value for strFullName (Not Null)
					 * @return string
					 */
					return $this->strFullName;

				case 'Title':
					/**
					 * Gets the value for strTitle (Not Null)
					 * @return string
					 */
					return $this->strTitle;

				case 'Owner':
					/**
					 * Gets the value for strOwner (Not Null)
					 * @return string
					 */
					return $this->strOwner;


				///////////////////
				// Member Objects
				///////////////////

				////////////////////////////
				// Virtual Object References (Many to Many and Reverse References)
				// (If restored via a "Many-to" expansion)
				////////////////////////////


				case '__Restored':
					return $this->__blnRestored;

				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

				/**
		 * Override method to perform a property "Set"
		 * This will set the property $strName to be $mixValue
		 *
		 * @param string $strName Name of the property to set
		 * @param string $mixValue New value of the property
		 * @return mixed
		 */
		public function __set($strName, $mixValue) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'Asin':
					/**
					 * Sets the value for strAsin (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strAsin = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Email':
					/**
					 * Sets the value for strEmail 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strEmail = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'TakenDate':
					/**
					 * Sets the value for dttTakenDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttTakenDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'ActualReturnDate':
					/**
					 * Sets the value for dttActualReturnDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttActualReturnDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'RealReturnDate':
					/**
					 * Sets the value for dttRealReturnDate (Not Null)
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttRealReturnDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'FullName':
					/**
					 * Sets the value for strFullName (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strFullName = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Title':
					/**
					 * Sets the value for strTitle (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strTitle = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Owner':
					/**
					 * Sets the value for strOwner (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strOwner = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}


				///////////////////
				// Member Objects
				///////////////////
				default:
					try {
						return parent::__set($strName, $mixValue);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		/**
		 * Lookup a VirtualAttribute value (if applicable).  Returns NULL if none found.
		 * @param string $strName
		 * @return string
		 */
		public function GetVirtualAttribute($strName) {
			if (array_key_exists($strName, $this->__strVirtualAttributeArray))
				return $this->__strVirtualAttributeArray[$strName];
			return null;
		}



		///////////////////////////////
		// ASSOCIATED OBJECTS' METHODS
		///////////////////////////////





		////////////////////////////////////////
		// METHODS for SOAP-BASED WEB SERVICES
		////////////////////////////////////////

		public static function GetSoapComplexTypeXml() {
			$strToReturn = '<complexType name="Assetsauditlog"><sequence>';
			$strToReturn .= '<element name="Id" type="xsd:int"/>';
			$strToReturn .= '<element name="Asin" type="xsd:string"/>';
			$strToReturn .= '<element name="Email" type="xsd:string"/>';
			$strToReturn .= '<element name="TakenDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="ActualReturnDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="RealReturnDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="FullName" type="xsd:string"/>';
			$strToReturn .= '<element name="Title" type="xsd:string"/>';
			$strToReturn .= '<element name="Owner" type="xsd:string"/>';
			$strToReturn .= '<element name="__blnRestored" type="xsd:boolean"/>';
			$strToReturn .= '</sequence></complexType>';
			return $strToReturn;
		}

		public static function AlterSoapComplexTypeArray(&$strComplexTypeArray) {
			if (!array_key_exists('Assetsauditlog', $strComplexTypeArray)) {
				$strComplexTypeArray['Assetsauditlog'] = Assetsauditlog::GetSoapComplexTypeXml();
			}
		}

		public static function GetArrayFromSoapArray($objSoapArray) {
			$objArrayToReturn = array();

			foreach ($objSoapArray as $objSoapObject)
				array_push($objArrayToReturn, Assetsauditlog::GetObjectFromSoapObject($objSoapObject));

			return $objArrayToReturn;
		}

		public static function GetObjectFromSoapObject($objSoapObject) {
			$objToReturn = new Assetsauditlog();
			if (property_exists($objSoapObject, 'Id'))
				$objToReturn->intId = $objSoapObject->Id;
			if (property_exists($objSoapObject, 'Asin'))
				$objToReturn->strAsin = $objSoapObject->Asin;
			if (property_exists($objSoapObject, 'Email'))
				$objToReturn->strEmail = $objSoapObject->Email;
			if (property_exists($objSoapObject, 'TakenDate'))
				$objToReturn->dttTakenDate = new QDateTime($objSoapObject->TakenDate);
			if (property_exists($objSoapObject, 'ActualReturnDate'))
				$objToReturn->dttActualReturnDate = new QDateTime($objSoapObject->ActualReturnDate);
			if (property_exists($objSoapObject, 'RealReturnDate'))
				$objToReturn->dttRealReturnDate = new QDateTime($objSoapObject->RealReturnDate);
			if (property_exists($objSoapObject, 'FullName'))
				$objToReturn->strFullName = $objSoapObject->FullName;
			if (property_exists($objSoapObject, 'Title'))
				$objToReturn->strTitle = $objSoapObject->Title;
			if (property_exists($objSoapObject, 'Owner'))
				$objToReturn->strOwner = $objSoapObject->Owner;
			if (property_exists($objSoapObject, '__blnRestored'))
				$objToReturn->__blnRestored = $objSoapObject->__blnRestored;
			return $objToReturn;
		}

		public static function GetSoapArrayFromArray($objArray) {
			if (!$objArray)
				return null;

			$objArrayToReturn = array();

			foreach ($objArray as $objObject)
				array_push($objArrayToReturn, Assetsauditlog::GetSoapObjectFromObject($objObject, true));

			return unserialize(serialize($objArrayToReturn));
		}

		public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects) {
			if ($objObject->dttTakenDate)
				$objObject->dttTakenDate = $objObject->dttTakenDate->__toString(QDateTime::FormatSoap);
			if ($objObject->dttActualReturnDate)
				$objObject->dttActualReturnDate = $objObject->dttActualReturnDate->__toString(QDateTime::FormatSoap);
			if ($objObject->dttRealReturnDate)
				$objObject->dttRealReturnDate = $objObject->dttRealReturnDate->__toString(QDateTime::FormatSoap);
			return $objObject;
		}




	}



	/////////////////////////////////////
	// ADDITIONAL CLASSES for QCubed QUERY
	/////////////////////////////////////

	class QQNodeAssetsauditlog extends QQNode {
		protected $strTableName = 'assetsauditlog';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'Assetsauditlog';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'Asin':
					return new QQNode('Asin', 'Asin', 'string', $this);
				case 'Email':
					return new QQNode('Email', 'Email', 'string', $this);
				case 'TakenDate':
					return new QQNode('TakenDate', 'TakenDate', 'QDateTime', $this);
				case 'ActualReturnDate':
					return new QQNode('ActualReturnDate', 'ActualReturnDate', 'QDateTime', $this);
				case 'RealReturnDate':
					return new QQNode('RealReturnDate', 'RealReturnDate', 'QDateTime', $this);
				case 'FullName':
					return new QQNode('FullName', 'FullName', 'string', $this);
				case 'Title':
<<<<<<< .mine
					return new QQNode('title', 'Title', 'string', $this);
=======
					return new QQNode('title', 'Title', 'string', $this);
				case 'Owner':
					return new QQNode('Owner', 'Owner', 'string', $this);
>>>>>>> .r75

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

	class QQReverseReferenceNodeAssetsauditlog extends QQReverseReferenceNode {
		protected $strTableName = 'assetsauditlog';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'Assetsauditlog';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'Asin':
					return new QQNode('Asin', 'Asin', 'string', $this);
				case 'Email':
					return new QQNode('Email', 'Email', 'string', $this);
				case 'TakenDate':
					return new QQNode('TakenDate', 'TakenDate', 'QDateTime', $this);
				case 'ActualReturnDate':
					return new QQNode('ActualReturnDate', 'ActualReturnDate', 'QDateTime', $this);
				case 'RealReturnDate':
					return new QQNode('RealReturnDate', 'RealReturnDate', 'QDateTime', $this);
				case 'FullName':
					return new QQNode('FullName', 'FullName', 'string', $this);
				case 'Title':
<<<<<<< .mine
					return new QQNode('title', 'Title', 'string', $this);
=======
					return new QQNode('title', 'Title', 'string', $this);
				case 'Owner':
					return new QQNode('Owner', 'Owner', 'string', $this);
>>>>>>> .r75

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

?>